#include<cstdio>
#include<cstring>
#include<queue>
using namespace std;
char inf[1000000];
struct Node
{
	int w,no[27],L;
	friend bool operator < (Node a,Node b)
	{
		return a.w>b.w;
	}
}a[27];
//Node a[27];
int ans[27];
int main()
{
	freopen("test.in","r",stdin);
	while(scanf("%s",inf),strcmp(inf,"END")!=0)
	{
		int len=strlen(inf);
		for(int i=0;i<=26;i++)
		{
			a[i].w=0;
			a[i].no[1]=i;
			a[i].L=1;
		}
		memset(ans,0,sizeof(ans));
		for(int i=0;i<len;i++)
		{
			if(inf[i]=='_')a[0].w++;
			else a[inf[i]-'A'+1].w++;
		}
		priority_queue<Node> pq;
		int n=0;
		for(int i=0;i<=26;i++)
			if(a[i].w!=0)
			{
				pq.push(a[i]);
				n++;
			}
		Node x,b;
		while(1)
		{
			x=pq.top();
			pq.pop();
			if(pq.empty())break;
			b=pq.top();
			pq.pop();
			Node res;
			res.w=x.w+b.w;
			for(int i=1;i<=x.L;i++)
			{
				res.no[i]=x.no[i];
				ans[x.no[i]]++;
			}
			for(int i=1;i<=b.L;i++)
			{
				res.no[i+x.L]=b.no[i];
				ans[b.no[i]]++;
			}
			res.L=x.L+b.L;
			pq.push(res);
		}
		int r=0;
		for(int i=0;i<=26;i++)
			r+=a[i].w*ans[i];
		if(n==1)r=len;
		printf("%d %d %0.1f\n",len*8,r,len*8.0/r);
		memset(inf,0,sizeof(inf));
	}
	return 0;
}
			
				





